/*
 * @Date: 2025-06-12 10:57:38
 * @LastEditors: lyx
 * @LastEditTime: 2025-06-13 14:06:31
 * @FilePath: \blog\src\plugins\remark-modified-time.js
 * @Description: 文章最后修改时间插件
 */
import { execSync } from "child_process";

export function remarkModifiedTime() {
  return function (tree, file) {
    const filepath = file.history[0];
    const result = execSync(`git log -1 --pretty="format:%cI" "${filepath}"`);
    file.data.astro.frontmatter.lastModified = result.toString();
  };
}
